Welcome to Seeing the Environmental Forest, now in its new home on Quarto Pub! I hope to give everyone the same science-based information but now with a higher quality venue.
So, why change? Blogspot is great for basic blogs but I found posting graphs and R code via Blogspot to be clunky. I had to export my graphs from R, convert them to JPEG, then upload them to Blogspot before finally using them in my posts. If anyone asked for my code, I had to copy and paste it from RStudio before reformatting it to make it even somewhat readable.
Using Quarto, I can run R code and get results right in my manuscript, with the code freely available to anyone who wants to reproduce my results. I’m actually typing this up in RStudio right now and can publish it right from my laptop. Here’s a taste of what Quarto allows me to do:
Show the code
#Load packageslibrary(tidyverse)library(plotly)#Import and clean the data to get annual temperatures using a mix of tidyverse and base RGISS <-read_table("https://data.giss.nasa.gov/gistemp/tabledata_v4/GLB.Ts+dSST.txt", skip =7)GISS <- GISS %>%select("Year", anomaly ="J-D")GISS$Year <-as.numeric(GISS$Year)GISS$anomaly <-as.numeric(GISS$anomaly)GISS$anomaly <- GISS$anomaly/100GISS <- GISS %>%na.omit()#Subset the dataGISS_1970 <-subset(GISS, Year >=1970)#Linear regression and confidence intervalsfit <-lm(anomaly ~ Year, data = GISS_1970)confidence <-confint(fit)#Plot the data with ggplot2 from tidyverse packagep <-ggplot(GISS_1970, aes(x = Year, y = anomaly)) +theme_bw() +geom_line(colour ="blue") +geom_smooth(method = loess,formula = y ~ x,aes(colour ="LOESS"),se =FALSE) +geom_smooth(method ="lm",formula = y ~ x,aes(colour ="Linear trend")) +labs(x ="Year",y ="Temperature anomaly (ºC)",title ="Trend in NASA GISS global mean surface temperature")#Turn the ggplot into an interactive ggplot with Plotlyggplotly(p)
Yes, that’s a fully interactive graph of annual NASA GISS surface temperatures since 1970 along with the LOESS and linear trends. The trend is quite rapid, with a rise of 1.889ºC per century (95% confidence interval: 1.713 to 2.065ºC per century). Compare that to the Paleocene-Eocene Thermal Maximum average rate of roughly 0.01ºC per century (Gutjahr et al. 2017) or the 0.045ºC rise at the end of the last glacial period (Shakun et al. 2012).
If you want to see the code that produced that graph, just click the little triangle above the graph with “Show the code” next to it. Want a copy of my code? There’s a faint clipboard outline in the upper right corner when your pointer is in the code block. Hit that icon then paste the contents into RStudio. The trend and confidence interval calculations in the paragraph above this one? Automated calculations using hidden inline R code.
I’m barely scratching the surface of this incredible new tool from RStudio. I intend to use its capabilities as I update my old blog posts from Blogspot and write new ones.
Until next time!
References
Gutjahr, Marcus, Andy Ridgwell, Philip F. Sexton, Eleni Anagnostou, Paul N. Pearson, Heiko Pälike, Richard D. Norris, Ellen Thomas, and Gavin L. Foster. 2017. “Very Large Release of Mostly Volcanic Carbon During the PalaeoceneEocene Thermal Maximum.”Nature 548 (7669): 573–77. https://doi.org/10.1038/nature23646.
Shakun, Jeremy D., Peter U. Clark, Feng He, Shaun A. Marcott, Alan C. Mix, Zhengyu Liu, Bette Otto-Bliesner, Andreas Schmittner, and Edouard Bard. 2012. “Global Warming Preceded by Increasing Carbon Dioxide Concentrations During the Last Deglaciation.”Nature 484 (7392): 49–54. https://doi.org/10.1038/nature10915.
Comment Section
Notes, suggestions, remarks? Feel free to leave a comment below.